{% extends 'home.html' %}
{% block content-title %}
    <title>注册出版社</title>
{% endblock %}
{% block content_main %}
    <style>
        .msg_error {
            color: red;
        }

        .radio_btn {
            font-size: 10px;
            height: 50px;
        }
    </style>
    <div class="panel panel-primary">
        <div class="panel-heading">
            <h3 class="panel-title">注册出版社</h3>
        </div>
        <div class="panel-body">
            <form action="" class="form-horizontal" method="post" id="publish_register">
                {% for form in login_form %}
                    <div class="form-group">
                        <label class="col-sm-2 control-label" for="id_{{ form.name }}">{{ form.label }}</label>
                        <div class="col-sm-10">
                            {{ form }}<span class="msg_error">{{ form.errors.0 }}</span>
                        </div>
                    </div>
                {% endfor %}
                {% for form in publish_form %}
                    <div class="form-group">
                        <label class="col-sm-2 control-label" for="id_{{ form.name }}">{{ form.label }}</label>
                        <div class="col-sm-10">
                            {{ form.as_widget }}<span class="msg_error">{{ form.errors.0 }}</span>
                        </div>
                    </div>
                {% endfor %}
                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <button type="submit" class="btn btn-success">注册</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
    <script>
        $('input').addClass('form-control');
        $('textarea').addClass('form-control');
    </script>
    <script>
        $('#publish_register').submit(
            function (event) {
                event.preventDefault();
                Swal.fire({
                    title: "请确认是否注册?",
                    text: "注册出版社!",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    cancelButtonColor: "#d33",
                    confirmButtonText: "确认"
                }).then((result) => {
                        if (result.isConfirmed) {
                            Swal.fire('提交成功', '', 'success').then(() => {
                                $(this).unbind('submit').submit();
                            })
                        }
                    }
                );
            }
        )
    </script>
{% endblock %}